/**
 * Commands for controlling LCD1602
 *
 * @author Jiashu Lin
 */

interface Lcd1602 {

  /**
   * Screen clear, set AC to 0 cursor position
   */
  async command void ScreenClear();

  /**
   * Cursor return, DDRAM AD=0, Return, Content Changeless
   */
  async command void CursorReturn();

  /**
   * Input Set, set moving direction of cursor, Appoint if move
   * I_D=1: increment Mode; I_D=0: decrement mode
   * S=1: Shift
   */
  async command void InputSet(uint8_t I_D, uint8_t S);

  /**
   * Display switch, set display on/off, cursor on/off, blink on/off
   *
   */
  async command void DisplaySwitch(uint8_t D, uint8_t C, uint8_t B);

  /**
   * Shift, remove cursor and whole display, DDRAM changeless
   * S_C=1: display shift; S_C=0: cursor shift
   * R_L=1: right shift; R_L=0: left shift
   */
  async command void Shift(uint8_t S_C, uint8_t R_L);

   /**
   * Function set, set DL, display line, font
   * DL=1: 8D; DL=0:4D
   * N=1: 2R; N=0: 1R
   * F=1: 5x10 Style; F=0:5x7 Style
   */
  async command void FunctionSet(uint8_t DL, uint8_t N, uint8_t F);

 
  /**
   * CGRAM AD set, set CGRAM AD, send receive data
   * ACG: CGRAM AD
   */
  async command void CgramAdSet(uint8_t ACG);

  /**
   * DDRAM AD set, set DDRAM AD, send receive data
   * ADD: DDRAM AD & Cursor AD & Cursor AD
   */
  async command void DdramAdSet(uint8_t ADD);

   /**
   * Busy/ad read CT, Executing internal function, reading AD of CT
   * BF=1: execute internal function; BF=0: command received
   */
  async command void BusyAdReadCt(uint8_t BF, uint8_t AC);

  /**
   * CGRAM/DDRAM data write, write data from CFGRAM or DDRAM
   * DATA: data to write
   */
  async command void CgramDdramDataWrite(uint8_t DATA);

  /**
   * CGRAM/DDRAM data read, read data from CFGRAM or DDRAM
   * DATA: data to read
   */
  async command void CgramDdramDataRead(uint8_t DATA);

}
